<template>
  <el-row class="row">
    <el-row>
      <el-col :span="24">
        <el-col :span="12">
          <el-page-header @back="goBack" content="审核任务"></el-page-header>
        </el-col>
        <el-col :span="12">
          <el-button type="danger" size="medium" style="float: right" @click="check_save_btn">退回</el-button>
          <el-button type="primary" size="medium" style="float: right;margin: 0 20px" @click="check_save_btn">通过</el-button>
        </el-col>
      </el-col>
    </el-row>
    <el-divider></el-divider>

    <el-col :span="8">
      <el-form ref="form" :model="form" label-width="120px">
        <el-form-item label="学号：">20176102203039</el-form-item>
        <el-form-item label="姓名：">王永川</el-form-item>
        <el-form-item label="学院：">信息工程</el-form-item>
        <el-form-item label="班级：">Z移动1704班</el-form-item>
        <el-form-item label="任务类型：">项目开题</el-form-item>
        <el-form-item label="状态：">未审核</el-form-item>
        <el-form-item label="评语：">
          <el-input type="textarea"></el-input>
        </el-form-item>
      </el-form>
    </el-col>
    <el-col :span="16">
      <el-card class="box-card" shadow="never">
        <div slot="header" class="clearfix">
          <span>附件</span>
          <el-button style="float: right; padding: 3px 0" type="text">全部下载</el-button>
        </div>
        <!--        图片-->
        <ul class="el-upload-list el-upload-list--picture-card">
          <span v-for="img in imgList2">
            <el-tooltip
              class="item"
              effect="light"
              content="开题报告开题报告开题报告开题报告.jpg"
              placement="bottom-start">
            <li tabindex="0" class="el-upload-list__item is-ready" v-if="img.type=='img'">
              <img class="el-upload-list__item-thumbnail" :src="img.url">
              <span class="el-upload-list__item-actions">
                  <span class="el-upload-list__item-preview" @click="imgCheck(img.url)">
                    <i class="el-icon-zoom-in"></i>
                  </span>
                  <span class="el-upload-list__item-delete" @click="imgDonwload(img.url)">
                    <i class="el-icon-download"></i>
                  </span>
              </span>
            </li></el-tooltip>
          </span>
        </ul>
        <!--        文件file-->
        <span class="file_card">
          <ul class="el-upload-list el-upload-list--picture-card">
            <span v-for="img in imgList2">
              <el-tooltip
                class="item"
                effect="dark"
                open-delay="0"
                hide-after="2000"
                content="开题报告开题报告开题报告开题报告.docx"
                placement="bottom-start">
                <li tabindex="0" class="el-upload-list__item is-ready" v-if="img.type=='file'">
                  <div class="demo-image__preview el-upload-list__item-thumbnail">
                    <el-image
                      style="width: 100px; height: 100px"
                      :src="img.url[0]"
                      :preview-src-list="img.url">
                    </el-image>
                    <span class="test" @click="fileDonwload(img)">
                      <i class="el-icon-download"></i>
                    </span>
                  </div>
                </li>
              </el-tooltip>
            </span>
          </ul>
        </span>
        <el-dialog :visible.sync="dialogVisible">
          <img width="100%" :src="dialogImageUrl" alt="">
        </el-dialog>

      </el-card>


    </el-col>
  </el-row>
</template>

<script>
    export default {
        name: "CheckTask",
        data() {
            return {
                dialogImageUrl: '',
                dialogVisible: false,
                disabled: false,
                form: {},
                // imageUrl: 'http://132.232.47.31:8080/image/w1.jpg',
                imgList: [
                    {
                        type: "img",
                        url: ["http://132.232.47.31:8080/image/w1.jpg"],
                    },
                    {
                        type: "file",
                        url: [
                            'http://132.232.47.31:8080/image/w1.jpg',
                            'http://132.232.47.31:8080/image/w2.jpg',
                        ],
                    },
                    {
                        type: "img",
                        url: ["http://132.232.47.31:8080/image/w2.jpg"],
                    },
                    {
                        type: "file",
                        url: [
                            'http://132.232.47.31:8080/image/w1.jpg',
                            'http://132.232.47.31:8080/image/w2.jpg',
                        ],
                    }
                ],
                imgList2: [
                    {"type": "img", "url": ["http://132.232.47.31:8080/image/w1.jpg"]},
                    {
                        "type": "file",
                        "url": ["http://132.232.47.31:8080/image/w1.jpg", "http://132.232.47.31:8080/image/w2.jpg"]
                    },{"type": "img", "url": ["http://132.232.47.31:8080/image/w1.jpg"]},
                    {
                        "type": "file",
                        "url": ["http://132.232.47.31:8080/image/w1.jpg", "http://132.232.47.31:8080/image/w2.jpg"]
                    },{"type": "img", "url": ["http://132.232.47.31:8080/image/w1.jpg"]},
                    {
                        "type": "file",
                        "url": ["http://132.232.47.31:8080/image/w1.jpg", "http://132.232.47.31:8080/image/w2.jpg"]
                    },{"type": "img", "url": ["http://132.232.47.31:8080/image/w1.jpg"]},
                    {
                        "type": "file",
                        "url": ["http://132.232.47.31:8080/image/w1.jpg", "http://132.232.47.31:8080/image/w2.jpg"]
                    },{"type": "img", "url": ["http://132.232.47.31:8080/image/w1.jpg"]},
                    {
                        "type": "file",
                        "url": ["http://132.232.47.31:8080/image/w1.jpg", "http://132.232.47.31:8080/image/w2.jpg"]
                    },
                ],
            }
        },
        methods: {
            goBack() {
                console.log('go back');
                this.$router.go(-1);//返回上一层
            },
            check_save_btn() {

            },
            handleRemove(file) {
                console.log("1");
            },
            imgDonwload: function (img) {
                console.log("imgDonwload:" + img)
                // this.$http.get("http://localhost:8088/static/photo.jpg")
                //     .then(response => {
                //             console.dir(response.data)
                //             let aTag = document.createElement('a');
                //             let blob = new ImageData(response.data);　　// 这个content是下载的文件内容，自己修改
                //             aTag.download = file_name;　　　　　　// 下载的文件名
                //             aTag.href = URL.createObjectURL(blob);
                //             aTag.click();
                //             URL.revokeObjectURL(blob);
                //         },
                //         response => {
                //             console.dir(response.data)
                //         })
            },
            imgCheck(img) {
                console.log("imgCheck:" + img)
                this.dialogImageUrl = img;
                this.dialogVisible = true;
            },
            fileDonwload(img) {
                console.log("fileDonwload:" + img)
            }
        }
    }
</script>

<style scoped>
  .tag_style {
    margin: 1px;
  }

  .row >>> .el-divider--horizontal {
    margin: 10px 0;
  }

  .row >>> .el-divider--horizontal {
    margin: 10px 0;
  }

  .row >>> .el-card__header {
    padding: 14px 24px;
  }

  .row >>> .el-upload-list__item {
    width: 100px;
    height: 100px;
  }

  .file_card >>> .el-upload-list__item-actions {
    height: 20%;
    font-size: 10px;
  }

  .file_card >>> .el-upload-list__item-thumbnail:hover .test {
    opacity: 1;
  }

  .test {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 20px;
    background: rgba(0, 0, 0, 0.5);
    color: #ffffff;
    opacity: 0;
    text-align: center;
    cursor: pointer;
    font-size: 16px;
    line-height: 20px;
  }

  .content {
    position: absolute;
    bottom: -30px;
    left: 0;
    width: 100%;
    height: 30px;
    background: rgba(0, 0, 0, 0.5);
    color: #ffffff;
    text-align: center;
    cursor: pointer;
    font-size: 16px;
    z-index: 9999;
  }
</style>
